﻿using System;

namespace Caramel.ServiceBus
{
	public class Callback : ICallback
	{
		public Callback()
		{
			this.Result = new CommandResult();
		}

		internal CommandResult Result { get; set; }

		public T Register<T>()
		{
			return (T)this.Result.ReturnValue;
		}

		public T Register<T>(Func<CommandResult, T> result)
		{
			return result(this.Result);
		}
	}
}
